﻿@model BookStore.Helpers.PagedList<BookStore.Models.UserInfo>

@{
    ViewBag.Title = "用户状态管理_管理员后台_第三波书店";
    Layout = "~/Areas/Admin/Views/Shared/_AdminLayout.cshtml";
}
@section scripts{
    <script src="~/Areas/Admin/Scripts/UserState.js"></script>
    <script>
        //根据状态搜索用户
        function toUserState() {
            location.href = "@Url.Action("Index", "UserState")?stateId=" + $("#userstate").val();
        }
    </script>
}

<div style="margin-left:5%;">
    <h3 style="line-height:30px;">您现在的位置：
        @Html.ActionLink("第三波","Index","../Home")&gt;
        @Html.ActionLink("管理员后台","Index","Home")&gt;
        @Html.ActionLink("用户状态管理","Index","UserState")
    </h3>
    @using (Html.BeginForm("UserStatus", "UserState", FormMethod.Post))
    { 
    <p style="font-weight:bold;font-size:14px;margin-bottom:5px;">
        用户状态：
        <select id="userstate" name="userstate" onchange="toUserState()">
            <option value="-1">---请选择---</option>
            @foreach (var us in ViewBag.UserStates)
            { 
               <option value="@us.Id" @if (us.Id == ViewBag.StateId){<text>selected="selected"</text>}>@us.Name</option>
            }
        </select>
        <input class="btn" type="submit" value="启用用户" name="action" style="width:120px;"/>
        <input class="btn" type="submit" value="禁用用户" name="action" style="width:120px;"/>
        <span class="message" style="color:red;">@TempData["message"]</span>
    </p>
    <table width="100%" style="text-align:center;margin-bottom:20px;">
        <tr style="font-size:16px;line-height:30px;background-color:lightsteelblue;">
            <th class="border_right" width="5%"><input type="checkbox" id="all"/></th>
            <th class="border_right" width="35%">用户名</th>
            <th class="border_right" width="30%">姓名</th>
            <th class="border_right" width="15%">角色</th>
            <th width="15%">状态</th>
        </tr>
        @{
            bool flag = false;
        }
        @foreach (var u in Model)
        {
            <tr @if (flag == false)
                {
                    <text>style="font-size:14px;line-height:25px;"</text>
                }
                else
                {
                    <text>style="font-size:14px;line-height:25px;background-color:lightblue;"</text>
                }>
                <td class="border" width="5%"><input type="checkbox" name="status" class="status" value="@u.Id"/></td>
                <td class="border_right" width="35%">@u.LoginId</td>
                <td class="border_right" width="30%">@u.Name</td>
                <td class="border_right" width="15%">@u.UserRole.Name</td>
                <td class="border_right" width="15%">@u.UserState.Name</td>
            </tr>
            flag = !flag;
        }
    </table>
 }
    @if (Model.Count>0)
    {
        <div class="pager">
            <hr />
            @Html.Pager(Model)
        </div>
    }else{
        <p>抱歉，没有找到符合条件的用户。</p>
    } 
</div>
  
